#include "media/branch/MediaBranchBT.h"

MediaBranchBT::MediaBranchBT(){

    BT_mainWidget->setFixedHeight(60);
    BT_mainWidget->doconfigur_secolor(QColor(248,248,255));
    MT_MediaPlayer->setAudioOutput(MT_audioPut);
    MT_audioPut->setVolume(DF_PLAYVOLUME);
    MT_MediaPlayer->setPlaybackRate(1);

    MT_tracksCover->doconfigur_pixmap(":/PIXMAP/bench/cover.jpg", QSize(BT_mainWidget->height() - 5, BT_mainWidget->height() - 5), false, 4);
    MT_tracksEcho->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    MT_tracksEcho->setFont(QFont("KaiTi_GB2312", 11));

    MT_speedView->doconfigur_textsetting(Qt::AlignHCenter | Qt::AlignVCenter);
    MT_speedView->doconfigur_text(QString("X%1").arg((double)DF_PLAYSPEED / 10));
    MT_speedView->doconfigur_fontgroup({{MSEVKEY.WIN_NORMAL, QFont("KaiTi_GB2312", 11)}});

    MT_screen->doconfigur_imgsetting(NT::DRAWTYPE_RECT);

    // playduration
    MT_duration->setFixedHeight(22);
    MT_duration->doconfigur_adjustedwidth(true);
    MT_duration->doconfigur_fontgroup({{MSEVKEY.WIN_NORMAL, QFont("KaiTi_GB2312", 10)}});
    MT_duration->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(116,124,141)}});

    MT_tracksSlider->d_text_visible(false);
    MT_tracksSlider->d_linear_addcolor({QColor(255,203,203), QColor(255,92,92), QColor(255,203,203)});
    MT_tracksSlider->d_linear_subcolor({QColor(211,224,214), QColor(95,136,105), QColor(211,224,214)});
    MT_tracksSlider->d_graph_variant(":/PIXMAP/bench/slider-corner2.png", 1);


    MD_playFuncHbox->addWidget(MT_medialast, 0, Qt::AlignVCenter);
    MD_playFuncHbox->addWidget(MT_mediastat, 0, Qt::AlignVCenter);
    MD_playFuncHbox->addWidget(MT_medianext, 0, Qt::AlignVCenter);
    MD_playFuncHbox->setContentsMargins(5, 0, 5, 0);
    MD_playFuncHbox->setSpacing(12);
    MD_playFuncHbox->setSizeConstraint(QLayout::SetFixedSize);

    BT_durationHbox->addWidget(MT_tracksEcho);
    BT_durationHbox->addWidget(MT_duration, 0, Qt::AlignRight);
    BT_durationVbox->addLayout(BT_durationHbox);
    BT_durationVbox->addWidget(MT_tracksSlider);
    BT_combineHbox->addWidget(MT_tracksCover, 0, Qt::AlignVCenter);
    BT_combineHbox->addLayout(BT_durationVbox, Qt::AlignVCenter);
    BT_durationHbox->setSpacing(2);
    BT_durationVbox->setSpacing(2);
    BT_durationVbox->setContentsMargins(0, 5, 0, 5);
    BT_combineHbox->setContentsMargins(0, 0, 0, 0);
    BT_combineHbox->setSpacing(2);

    BT_additionHbox->addWidget(MT_mdplermode);
    BT_additionHbox->addWidget(MT_volumeView);
    BT_additionHbox->addWidget(MT_speedView);
    BT_additionHbox->addWidget(MT_screen);
    BT_additionHbox->setSpacing(6);

    MT_mdplermode->doconfigur_brighttype(NT::DRAWTYPE_RECT, 4);
    MT_volumeView->doconfigur_brighttype(NT::DRAWTYPE_RECT, 4);
    MT_speedView->doconfigur_brighttype(NT::DRAWTYPE_RECT, 4);
    MT_screen->doconfigur_brighttype(NT::DRAWTYPE_RECT, 4);
    MT_mdplermode->doconfigur_imgsetting(6);
    MT_volumeView->doconfigur_imgsetting(6);
    MT_speedView->doconfigur_imgsetting(6);
    MT_screen->doconfigur_imgsetting(6);

    BT_mainGrid->addLayout(MD_playFuncHbox, 0, 0, 5, 1, Qt::AlignVCenter);
    BT_mainGrid->addLayout(BT_combineHbox, 0, 1, 5, 8, Qt::AlignVCenter);
    BT_mainGrid->addLayout(BT_additionHbox, 0, 9, 5, 4, Qt::AlignVCenter);
    BT_mainWidget->setContentsMargins(0, 0, 0, 0);
    BT_mainGrid->setContentsMargins(10, 0, 0, 0);
    BT_mainGrid->setHorizontalSpacing(10);

}




